package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserCouponsHistoryMapper;
import com.ruoyi.system.domain.UserCouponsHistory;
import com.ruoyi.system.service.IUserCouponsHistoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户优惠券历史Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-22
 */
@Service
public class UserCouponsHistoryServiceImpl implements IUserCouponsHistoryService 
{
    @Autowired
    private UserCouponsHistoryMapper userCouponsHistoryMapper;

    /**
     * 查询用户优惠券历史
     * 
     * @param id 用户优惠券历史主键
     * @return 用户优惠券历史
     */
    @Override
    public UserCouponsHistory selectUserCouponsHistoryById(String id)
    {
        return userCouponsHistoryMapper.selectUserCouponsHistoryById(id);
    }

    /**
     * 查询用户优惠券历史列表
     * 
     * @param userCouponsHistory 用户优惠券历史
     * @return 用户优惠券历史
     */
    @Override
    public List<UserCouponsHistory> selectUserCouponsHistoryList(UserCouponsHistory userCouponsHistory)
    {
        return userCouponsHistoryMapper.selectUserCouponsHistoryList(userCouponsHistory);
    }

    /**
     * 新增用户优惠券历史
     * 
     * @param userCouponsHistory 用户优惠券历史
     * @return 结果
     */
    @Override
    public int insertUserCouponsHistory(UserCouponsHistory userCouponsHistory)
    {
        userCouponsHistory.setCreateTime(DateUtils.getNowDate());
        return userCouponsHistoryMapper.insertUserCouponsHistory(userCouponsHistory);
    }

    /**
     * 修改用户优惠券历史
     * 
     * @param userCouponsHistory 用户优惠券历史
     * @return 结果
     */
    @Override
    public int updateUserCouponsHistory(UserCouponsHistory userCouponsHistory)
    {
        userCouponsHistory.setUpdateTime(DateUtils.getNowDate());
        return userCouponsHistoryMapper.updateUserCouponsHistory(userCouponsHistory);
    }

    /**
     * 批量删除用户优惠券历史
     * 
     * @param ids 需要删除的用户优惠券历史主键
     * @return 结果
     */
    @Override
    public int deleteUserCouponsHistoryByIds(String ids)
    {
        return userCouponsHistoryMapper.deleteUserCouponsHistoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户优惠券历史信息
     * 
     * @param id 用户优惠券历史主键
     * @return 结果
     */
    @Override
    public int deleteUserCouponsHistoryById(String id)
    {
        return userCouponsHistoryMapper.deleteUserCouponsHistoryById(id);
    }
}
